package com.yize.miniweather.view.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;

import com.yize.miniweather.R;

import java.util.Timer;
import java.util.TimerTask;

public class loadPage extends AppCompatActivity {
    private int recLen = 1;
    Timer timer = new Timer();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_load_page);
        timer.schedule(timerTask,1000,1000);
    }

    TimerTask timerTask = new TimerTask() {
        @Override
        public void run() {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    recLen--;
                    if(recLen < 0){
                        timer.cancel();
                        Intent intent = new Intent();
                        intent.setClass(loadPage.this,MainActivity.class);
                        startActivity(intent);
                    }
                }
            });
        }
    };
}